package com.cskaoyan.service.adminservice.impl;

import com.cskaoyan.mapper.MarketSystemMapper;
import com.cskaoyan.service.adminservice.ConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.*;

/**
 * @author 楚夏三分
 * @datetime 2022/12/29 21:20
 * @description: TODO:
 */
@Service
public class ConfigServiceImpl implements ConfigService {
    @Autowired
    MarketSystemMapper marketSystemMapper;

    @Override
    public HashMap<String, String> list(ArrayList<String> list) {
        HashMap<String, String> resultMap = new HashMap<>();
        for (String keyName : list) {
            String value = marketSystemMapper.selectByKeyName(keyName);
            resultMap.put(keyName,value);
        }
        return resultMap;
    }

    @Override
    public void update(HashMap<String, String> map) {
        for (String key : map.keySet()) {
            marketSystemMapper.updateMallValueByKeyName(key,map.get(key),new Date());
            System.out.println(map.get(key));
        }
    }
}
